SPB Git forge

spb/polyllm

Public
15commits 1branches 0releases
2.2 MBsize
maindefault branch
13 days agolast push
TypeScript 97.4% SQL 1% JavaScript 0.9% CSS 0.6%
707 B · 18 lines typescript
Raw Blame History
1import { withUser, parseBody, json } from "@/lib/api";2import { usePrompt } from "@/lib/prompts/service";3import { promptUseSchema } from "@/lib/prompts/schemas";45export const dynamic = "force-dynamic";67type P = { id: string };89/**10 * POST /api/prompts/:id/use { variables?: Record<string, string> }11 * → { prompt, kind, rendered, text, systemPrompt, schema, defaultModelKey, missing, defaulted }12 * Increments `uses`, stamps `lastUsedAt` and renders `{{variables}}` (values → declared defaults → "").13 */14export const POST = withUser<P>(async ({ req, user }, { id }) => {15  const body = await parseBody(req, promptUseSchema);16  return json(await usePrompt(user.id, id, body.variables ?? {}));17});18